package com.atguigu.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author houChen
 * @date 2021/10/31 9:37
 * @Description: Redisson的配置类
 */
@Configuration
public class MyRedissonConfig {
    /**
     *  所有对Redisson的使用都是通过RedissonClient对象
     */
    @Bean
    public RedissonClient redisson(){
        //1、创建配置
        Config config = new Config();
        config.useSingleServer().setAddress("redis://121.40.182.123:6379");
        //2、创建RedissonClient
        return Redisson.create(config);
    }
}